<?php

/**
 * This is the model class for table "buildingserviceequipment".
 *
 * The followings are the available columns in table 'buildingserviceequipment':
 * @property integer $Id
 * @property integer $BoilerProvided
 * @property integer $BoilerNoOfUnitsProvided
 * @property integer $BoilerFuel
 * @property string $BoilerCapacity
 * @property integer $BoilerContainer
 * @property string $BoilerLocation
 * @property integer $BoilerLPGInstallationCoveredWithPermit
 * @property integer $BoilerFuelWithStoragePermit
 * @property integer $GeneratorSetProvided
 * @property integer $GeneratorType
 * @property integer $GeneratorSetFuel
 * @property string $GeneratorSetCapacity
 * @property string $GeneratorSetLocation
 * @property integer $GeneratorSetDikesOrBundwallProvided
 * @property integer $GeneratorSetContainer
 * @property integer $GeneratorSetDispensingSystem
 * @property string $GeneratorSetOutputCapacity
 * @property string $GeneratorSetKvaMechanicalPermit
 * @property string $GeneratorSetDateIssued
 * @property integer $GeneratorSetFuelWithStoragePermit
 * @property string $GeneratorSetOther
 * @property integer $RefuseGarbageHandlingFacilityProvided
 * @property integer $RefuseGarbageHandlingFacilityEnclosureProvided
 * @property integer $RefuseGarbageHandlingFacilityFireResistive
 * @property integer $RefuseGarbageHandlingFacilityFireProtectionProvided
 * @property string $RefuseGarbageHandlingFacilityType
 * @property string $RefuseGarbageHandlingFacilityFrequencyOfCollectionOrDisposal
 * @property string $RefuseGarbageHandlingFacilityHowCollected
 * @property integer $ElectricalSystemIsThereAnyHazard
 * @property string $ElectricalSystemSpecifyLocation
 * @property integer $MechanicalSystemIsThereAnyMechanicalHazard
 * @property string $MechanicalSystemSpecifyLocation
 * @property integer $MechanicalSystemNoOfElevatorsProvided
 * @property integer $MechanicalSystemFiremansElevatorProvided
 * @property integer $MechanicalSystemFiremansKeyOrSwitchProvided
 * @property integer $OtherBuildingServiceSystemsWaterTreatmentFacility
 * @property integer $OtherBuildingServiceSystemsWasteWaterOrSewageTreatmentFacility
 * @property integer $Establishment_Id
 *
 * The followings are the available model relations:
 * @property Establishments $establishment
 */
class Buildingserviceequipment extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Buildingserviceequipment the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'buildingserviceequipment';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('BoilerProvided, BoilerNoOfUnitsProvided, BoilerFuel, BoilerContainer, BoilerLPGInstallationCoveredWithPermit, BoilerFuelWithStoragePermit, GeneratorSetProvided, GeneratorType, GeneratorSetFuel, GeneratorSetDikesOrBundwallProvided, GeneratorSetContainer, GeneratorSetDispensingSystem, GeneratorSetFuelWithStoragePermit, RefuseGarbageHandlingFacilityProvided, RefuseGarbageHandlingFacilityEnclosureProvided, RefuseGarbageHandlingFacilityFireResistive, RefuseGarbageHandlingFacilityFireProtectionProvided, ElectricalSystemIsThereAnyHazard, MechanicalSystemIsThereAnyMechanicalHazard, MechanicalSystemNoOfElevatorsProvided, MechanicalSystemFiremansElevatorProvided, MechanicalSystemFiremansKeyOrSwitchProvided, OtherBuildingServiceSystemsWaterTreatmentFacility, OtherBuildingServiceSystemsWasteWaterOrSewageTreatmentFacility, Establishment_Id', 'numerical', 'integerOnly'=>true),
			array('BoilerCapacity, GeneratorSetCapacity, GeneratorSetOutputCapacity', 'length', 'max'=>45),
			array('BoilerLocation, GeneratorSetLocation, GeneratorSetKvaMechanicalPermit, GeneratorSetOther, RefuseGarbageHandlingFacilityType, ElectricalSystemSpecifyLocation, MechanicalSystemSpecifyLocation', 'length', 'max'=>60),
			array('RefuseGarbageHandlingFacilityFrequencyOfCollectionOrDisposal, RefuseGarbageHandlingFacilityHowCollected', 'length', 'max'=>100),
			array('GeneratorSetDateIssued', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('Id, BoilerProvided, BoilerNoOfUnitsProvided, BoilerFuel, BoilerCapacity, BoilerContainer, BoilerLocation, BoilerLPGInstallationCoveredWithPermit, BoilerFuelWithStoragePermit, GeneratorSetProvided, GeneratorType, GeneratorSetFuel, GeneratorSetCapacity, GeneratorSetLocation, GeneratorSetDikesOrBundwallProvided, GeneratorSetContainer, GeneratorSetDispensingSystem, GeneratorSetOutputCapacity, GeneratorSetKvaMechanicalPermit, GeneratorSetDateIssued, GeneratorSetFuelWithStoragePermit, GeneratorSetOther, RefuseGarbageHandlingFacilityProvided, RefuseGarbageHandlingFacilityEnclosureProvided, RefuseGarbageHandlingFacilityFireResistive, RefuseGarbageHandlingFacilityFireProtectionProvided, RefuseGarbageHandlingFacilityType, RefuseGarbageHandlingFacilityFrequencyOfCollectionOrDisposal, RefuseGarbageHandlingFacilityHowCollected, ElectricalSystemIsThereAnyHazard, ElectricalSystemSpecifyLocation, MechanicalSystemIsThereAnyMechanicalHazard, MechanicalSystemSpecifyLocation, MechanicalSystemNoOfElevatorsProvided, MechanicalSystemFiremansElevatorProvided, MechanicalSystemFiremansKeyOrSwitchProvided, OtherBuildingServiceSystemsWaterTreatmentFacility, OtherBuildingServiceSystemsWasteWaterOrSewageTreatmentFacility, Establishment_Id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'establishment' => array(self::BELONGS_TO, 'Establishments', 'Establishment_Id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'Id' => 'ID',
			'BoilerProvided' => 'Boiler Provided',
			'BoilerNoOfUnitsProvided' => 'Boiler No Of Units Provided',
			'BoilerFuel' => 'Boiler Fuel',
			'BoilerCapacity' => 'Boiler Capacity',
			'BoilerContainer' => 'Boiler Container',
			'BoilerLocation' => 'Boiler Location',
			'BoilerLPGInstallationCoveredWithPermit' => 'Boiler Lpginstallation Covered With Permit',
			'BoilerFuelWithStoragePermit' => 'Boiler Fuel With Storage Permit',
			'GeneratorSetProvided' => 'Generator Set Provided',
			'GeneratorType' => 'Generator Type',
			'GeneratorSetFuel' => 'Generator Set Fuel',
			'GeneratorSetCapacity' => 'Generator Set Capacity',
			'GeneratorSetLocation' => 'Generator Set Location',
			'GeneratorSetDikesOrBundwallProvided' => 'Generator Set Dikes Or Bundwall Provided',
			'GeneratorSetContainer' => 'Generator Set Container',
			'GeneratorSetDispensingSystem' => 'Generator Set Dispensing System',
			'GeneratorSetOutputCapacity' => 'Generator Set Output Capacity',
			'GeneratorSetKvaMechanicalPermit' => 'Generator Set Kva Mechanical Permit',
			'GeneratorSetDateIssued' => 'Generator Set Date Issued',
			'GeneratorSetFuelWithStoragePermit' => 'Generator Set Fuel With Storage Permit',
			'GeneratorSetOther' => 'Generator Set Other',
			'RefuseGarbageHandlingFacilityProvided' => 'Refuse Garbage Handling Facility Provided',
			'RefuseGarbageHandlingFacilityEnclosureProvided' => 'Refuse Garbage Handling Facility Enclosure Provided',
			'RefuseGarbageHandlingFacilityFireResistive' => 'Refuse Garbage Handling Facility Fire Resistive',
			'RefuseGarbageHandlingFacilityFireProtectionProvided' => 'Refuse Garbage Handling Facility Fire Protection Provided',
			'RefuseGarbageHandlingFacilityType' => 'Refuse Garbage Handling Facility Type',
			'RefuseGarbageHandlingFacilityFrequencyOfCollectionOrDisposal' => 'Refuse Garbage Handling Facility Frequency Of Collection Or Disposal',
			'RefuseGarbageHandlingFacilityHowCollected' => 'Refuse Garbage Handling Facility How Collected',
			'ElectricalSystemIsThereAnyHazard' => 'Electrical System Is There Any Hazard',
			'ElectricalSystemSpecifyLocation' => 'Electrical System Specify Location',
			'MechanicalSystemIsThereAnyMechanicalHazard' => 'Mechanical System Is There Any Mechanical Hazard',
			'MechanicalSystemSpecifyLocation' => 'Mechanical System Specify Location',
			'MechanicalSystemNoOfElevatorsProvided' => 'Mechanical System No Of Elevators Provided',
			'MechanicalSystemFiremansElevatorProvided' => 'Mechanical System Firemans Elevator Provided',
			'MechanicalSystemFiremansKeyOrSwitchProvided' => 'Mechanical System Firemans Key Or Switch Provided',
			'OtherBuildingServiceSystemsWaterTreatmentFacility' => 'Other Building Service Systems Water Treatment Facility',
			'OtherBuildingServiceSystemsWasteWaterOrSewageTreatmentFacility' => 'Other Building Service Systems Waste Water Or Sewage Treatment Facility',
			'Establishment_Id' => 'Establishment',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('Id',$this->Id);
		$criteria->compare('BoilerProvided',$this->BoilerProvided);
		$criteria->compare('BoilerNoOfUnitsProvided',$this->BoilerNoOfUnitsProvided);
		$criteria->compare('BoilerFuel',$this->BoilerFuel);
		$criteria->compare('BoilerCapacity',$this->BoilerCapacity,true);
		$criteria->compare('BoilerContainer',$this->BoilerContainer);
		$criteria->compare('BoilerLocation',$this->BoilerLocation,true);
		$criteria->compare('BoilerLPGInstallationCoveredWithPermit',$this->BoilerLPGInstallationCoveredWithPermit);
		$criteria->compare('BoilerFuelWithStoragePermit',$this->BoilerFuelWithStoragePermit);
		$criteria->compare('GeneratorSetProvided',$this->GeneratorSetProvided);
		$criteria->compare('GeneratorType',$this->GeneratorType);
		$criteria->compare('GeneratorSetFuel',$this->GeneratorSetFuel);
		$criteria->compare('GeneratorSetCapacity',$this->GeneratorSetCapacity,true);
		$criteria->compare('GeneratorSetLocation',$this->GeneratorSetLocation,true);
		$criteria->compare('GeneratorSetDikesOrBundwallProvided',$this->GeneratorSetDikesOrBundwallProvided);
		$criteria->compare('GeneratorSetContainer',$this->GeneratorSetContainer);
		$criteria->compare('GeneratorSetDispensingSystem',$this->GeneratorSetDispensingSystem);
		$criteria->compare('GeneratorSetOutputCapacity',$this->GeneratorSetOutputCapacity,true);
		$criteria->compare('GeneratorSetKvaMechanicalPermit',$this->GeneratorSetKvaMechanicalPermit,true);
		$criteria->compare('GeneratorSetDateIssued',$this->GeneratorSetDateIssued,true);
		$criteria->compare('GeneratorSetFuelWithStoragePermit',$this->GeneratorSetFuelWithStoragePermit);
		$criteria->compare('GeneratorSetOther',$this->GeneratorSetOther,true);
		$criteria->compare('RefuseGarbageHandlingFacilityProvided',$this->RefuseGarbageHandlingFacilityProvided);
		$criteria->compare('RefuseGarbageHandlingFacilityEnclosureProvided',$this->RefuseGarbageHandlingFacilityEnclosureProvided);
		$criteria->compare('RefuseGarbageHandlingFacilityFireResistive',$this->RefuseGarbageHandlingFacilityFireResistive);
		$criteria->compare('RefuseGarbageHandlingFacilityFireProtectionProvided',$this->RefuseGarbageHandlingFacilityFireProtectionProvided);
		$criteria->compare('RefuseGarbageHandlingFacilityType',$this->RefuseGarbageHandlingFacilityType,true);
		$criteria->compare('RefuseGarbageHandlingFacilityFrequencyOfCollectionOrDisposal',$this->RefuseGarbageHandlingFacilityFrequencyOfCollectionOrDisposal,true);
		$criteria->compare('RefuseGarbageHandlingFacilityHowCollected',$this->RefuseGarbageHandlingFacilityHowCollected,true);
		$criteria->compare('ElectricalSystemIsThereAnyHazard',$this->ElectricalSystemIsThereAnyHazard);
		$criteria->compare('ElectricalSystemSpecifyLocation',$this->ElectricalSystemSpecifyLocation,true);
		$criteria->compare('MechanicalSystemIsThereAnyMechanicalHazard',$this->MechanicalSystemIsThereAnyMechanicalHazard);
		$criteria->compare('MechanicalSystemSpecifyLocation',$this->MechanicalSystemSpecifyLocation,true);
		$criteria->compare('MechanicalSystemNoOfElevatorsProvided',$this->MechanicalSystemNoOfElevatorsProvided);
		$criteria->compare('MechanicalSystemFiremansElevatorProvided',$this->MechanicalSystemFiremansElevatorProvided);
		$criteria->compare('MechanicalSystemFiremansKeyOrSwitchProvided',$this->MechanicalSystemFiremansKeyOrSwitchProvided);
		$criteria->compare('OtherBuildingServiceSystemsWaterTreatmentFacility',$this->OtherBuildingServiceSystemsWaterTreatmentFacility);
		$criteria->compare('OtherBuildingServiceSystemsWasteWaterOrSewageTreatmentFacility',$this->OtherBuildingServiceSystemsWasteWaterOrSewageTreatmentFacility);
		$criteria->compare('Establishment_Id',$this->Establishment_Id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}